"use strict";

$(function () {
    var urlId = GetQueryString('id');
    $.ajax({
        type: "get", //请求类型
        datatype: "json", //数据类型
        url: "js/index1.json", //向哪里请求
        success: function success(data) {
            //请求成功后执行该函数
            var data_list = data.result;
            var boxJson = data_list.find(function (item, index, data_list) {
                if (item.id == urlId) return item;
            }, this);
            $('#box').html('');
            if (boxJson) {
                if (boxJson.model == 'UX300e') {
                    $('#box').html("<div class=\"imgBox width100\"><img src=\"" + boxJson.img + "\" class=\"commonImgWidth\"></div><div class=\"txtBox\"><p class=\"title\">" + boxJson.title + "</p><div class=\"contentBox\">" + boxJson.body + "</div></div><div class=\"footerBox\"><div class=\"footerChild\"><span class=\"left\">UX<br>300e</span><span class=\"rt\"></span></div></div>");
                } else if (boxJson.model == 'COMMON') {
                    $('#box').html("<div class=\"imgBox width100\"><img src=\"" + boxJson.img + "\" class=\"commonImgWidth\"></div><div class=\"txtBox\"><p class=\"title\">" + boxJson.title + "</p><div class=\"contentBox\">" + boxJson.body + "</div></div><div class=\"footerBox\"><div class=\"footerChild\"><span class=\"left\">\u901A\u7528\u54C1</span><span class=\"rt\"></span></div></div>");
                } else {
                    $('#box').html("<div class=\"imgBox width100\"><img src=\"" + boxJson.img + "\" class=\"commonImgWidth\"></div><div class=\"txtBox\"><p class=\"title\">" + boxJson.title + "</p><div class=\"contentBox\">" + boxJson.body + "</div></div><div class=\"footerBox\"><div class=\"footerChild\"><span class=\"lt\">" + boxJson.model + "</span><span class=\"rt\"></span></div></div>");
                }
            } else {
                $('#box').html("<p>\u6CA1\u6709\u627E\u5230\u76F8\u5E94\u6570\u636E</p>");
            }
        }
    });
});